﻿<UserControl x:Class="Soapi.Notify2.QuestionsView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:ValueConverters="clr-namespace:Soapi.Contrib.ValueConverters" xmlns:Notify2="clr-namespace:Soapi.Notify2"  Loaded="UserControl_Loaded" Width="620">
    <UserControl.Resources>
        <ValueConverters:TimeAgoConverter x:Key="TimeAgoConverter" />
        <ValueConverters:ReputationConverter x:Key="ReputationConverter" />
        <ValueConverters:AnsweredColorConverter x:Key="AnsweredColorConverter" />
        <ValueConverters:ViewsConverter x:Key="ViewsConverter" />
    </UserControl.Resources>
    <Border BorderThickness="0" Margin="0,2,0,2" Padding="0,0,10,0">
        <Grid x:Name="LayoutRoot" Background="#FFF7F6F6" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="32"/>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="40"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>

            <StackPanel Grid.Column="0" Grid.Row="0"  Margin="0,3,0,3">
                <Image x:Name="SiteIcon" Width="32" Height="32"/>
            </StackPanel>
            <StackPanel Grid.Column="1" Grid.Row="0"  Margin="0,3,0,3">
                <TextBlock Text="{Binding Score}" HorizontalAlignment="Center" FontSize="16" FontWeight="Bold" Foreground="#FF999999" />
                <TextBlock Text="votes" HorizontalAlignment="Center" Foreground="#FF999999" Margin="0" FontSize="8"/>
            </StackPanel>

            <Border Grid.Column="2" Grid.Row="0" BorderThickness="1,0" BorderBrush="#FFC0C8DD"  Margin="0,3,0,3">
                <StackPanel >
                    <TextBlock Text="{Binding AnswerCount}" HorizontalAlignment="Center" FontSize="16" FontWeight="Bold" Foreground="{Binding Converter={StaticResource AnsweredColorConverter}}"/>
                    <TextBlock Text="answers" HorizontalAlignment="Center"  Margin="0" FontSize="8" Foreground="#FF999999"/>
                </StackPanel>
            </Border>

            <StackPanel Grid.Column="3" Grid.Row="0"  Margin="0,3,0,3">
                <TextBlock Text="{Binding ViewCount, Converter={StaticResource ViewsConverter}}" HorizontalAlignment="Center" FontSize="16" FontWeight="Bold" Foreground="#FFBBBBBB"/>
                <TextBlock Text="views" HorizontalAlignment="Center" Foreground="#FF999999" Margin="0" FontSize="8"/>
            </StackPanel>

            <StackPanel Grid.Column="4" Grid.Row="0" Margin="5,0,0,0">
                <TextBlock Text="{Binding Title}" FontSize="12" Foreground="#FF5555AA" Margin="0,3,0,3" TextWrapping="Wrap" TextDecorations="Underline" Cursor="Hand" Mouse.MouseUp="TextBlock_MouseUp" />
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="6*" />
                        <ColumnDefinition Width="4*" />
                    </Grid.ColumnDefinitions>
                    <ItemsControl x:Name="HorizontalListBox" ItemsSource="{Binding Tags}">
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Horizontal" Background="Transparent"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Padding="2,0" Background="#FFE7ECEC" BorderBrush="#FF555555" BorderThickness="1" CornerRadius="2" Margin="2,0">
                                    <TextBlock Text="{Binding .}" FontSize="9.333" Foreground="#FF555555"/>
                                </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>

                    <StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
                        <TextBlock Text="{Binding CreationDate, Converter={StaticResource TimeAgoConverter}}" Foreground="#FF9999B9" Margin="0,0,5,0" FontSize="8" VerticalAlignment="Center" FontStretch="UltraCondensed"/>
                        <TextBlock Text="{Binding Owner.DisplayName}" Foreground="#FF5555AA" FontSize="9.333" Margin="0,0,5,0" VerticalAlignment="Center" FontStretch="UltraCondensed" TextDecorations="Underline" Cursor="Hand" Mouse.MouseUp="TextBlock_MouseUp_1"/>
                        <TextBlock Text="{Binding Owner.Reputation, Converter={StaticResource ReputationConverter}}" Foreground="#FF444465" Margin="0,0,5,0" FontWeight="Bold" FontSize="9.333" VerticalAlignment="Center"/>
                    </StackPanel>

                </Grid>
            </StackPanel>
        </Grid>
    </Border>
</UserControl>
